//
//  YSGBannerViewModel.swift
//  EyeVisionForPatients
//
//  Created by PMC on 2020/11/19.
//  Copyright © 2020 QDSG. All rights reserved.
//

import HandyJSON

struct YSGBanner: HandyJSON {
    var columnType: Int = 0
    var id: Int = 0
    var sort: Int = 0
    var createTime: Date?
    var updateTime: Date?
    var isDelete: Int = 0
    var target: String?
    var content: String?
    var jumpMode: YSGJSPushType?
}

struct YSGBannerViewModel {
    let models: [YSGBanner]
    
    var numberOfItems: Int { models.count }
    
    func viewModel(at index: Int) -> YSGBannerCellViewModel {
        return YSGBannerCellViewModel(model: models[index])
    }
    
    var cellHeight: CGFloat {
        numberOfItems == 0 ? 0 : 72
    }
}

struct YSGBannerCellViewModel {
    let model: YSGBanner
}
